#include <iostream>

using namespace std;

const int N = 110;
char a[N][N];
bool st[N][N];
int n;
int pos, l_x[N * N], l_y[N * N];

int dx[] = { 0, 0, 1, -1, 1, 1, -1, -1 };
int dy[] = { 1, -1, 0, 0, 1, -1, 1, -1 };

void dfs(int i, int j)
{
	for (int k = 0; k < 8; k++)
	{
		if (i + 6 * dx[k] >= 1 && i + 6 * dx[k] <= n && j + 6 * dy[k] >= 1 && j + 6 * dy[k] <= n)
		{
			if (a[i + dx[k]][j + dy[k]] == 'i'
				&& a[i + 2 * dx[k]][j + 2 * dy[k]] == 'z'
				&& a[i + 3 * dx[k]][j + 3 * dy[k]] == 'h'
				&& a[i + 4 * dx[k]][j + 4 * dy[k]] == 'o'
				&& a[i + 5 * dx[k]][j + 5 * dy[k]] == 'n'
				&& a[i + 6 * dx[k]][j + 6 * dy[k]] == 'g')
			{
				st[i][j] = true;
				st[i + 1 * dx[k]][j + 1 * dy[k]] = true;
				st[i + 2 * dx[k]][j + 2 * dy[k]] = true;
				st[i + 3 * dx[k]][j + 3 * dy[k]] = true;
				st[i + 4 * dx[k]][j + 4 * dy[k]] = true;
				st[i + 5 * dx[k]][j + 5 * dy[k]] = true;
				st[i + 6 * dx[k]][j + 6 * dy[k]] = true;

			}
		}
	}
}

int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			cin >> a[i][j];
			if (a[i][j] == 'y')
			{
				l_x[++pos] = i;
				l_y[pos] = j;
			}
		}
	}

	for (int i = 1; i <= pos; i++)
	{
		dfs(l_x[i], l_y[i]);
	}
	cout << endl;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (st[i][j]) cout << a[i][j];
			else cout << "*";
		}
		cout << endl;
	}
	return 0;
}

